package com.finchina.myview;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

/**
 * 作者：黄赛赛 on 2015/8/11 17:14
 *
 * @version V1.0
 * @Description: ${todo}()
 */
public class Title extends RelativeLayout {

    Button btn_title_left, btn_title_right;
    TextView tv_title_name;

    public Title(Context context) {
        super(context);
    }

    public Title(Context context, AttributeSet attrs) {
        super(context, attrs);
        LayoutInflater.from(context).inflate(R.layout.title, this);
        btn_title_left = (Button) findViewById(R.id.btn_title_left);
        btn_title_right = (Button) findViewById(R.id.btn_title_right);
        tv_title_name = (TextView) findViewById(R.id.tv_title_name);

    }

    public Title(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        super.onLayout(changed, l, t, r, b);
    }

    public void setBtn_title_leftText(String text) {
        btn_title_left.setText(text);
    }

    public void setBtn_title_leftBackRes(int resId) {
        btn_title_left.setBackgroundResource(resId);
    }

    public void setBtn_title_rightText(String text) {
        btn_title_right.setText(text);
    }

    public void setBtn_title_rightBackRes(int resId) {
        btn_title_right.setBackgroundResource(resId);
    }

    public void setTitle(String title) {
        tv_title_name.setText(title);
    }
}
